<!--
 * @Date: 2022-06-29 09:25:09
 * @LastEditTime: 2022-07-12 22:31:39
-->
<template>
  <div id="app">
    <router-view/>
    <!-- <div id="app-footer"></div> -->
  </div>
</template>

<script>
// import { getUserInfo } from '@/api/user'
export default {
  name: 'App',
  created () {
    if (sessionStorage.getItem('store')) {
      this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))))
      sessionStorage.removeItem('store')
    }
    // getUserInfo()
    //   .then(res => {
    //     if (res.data.state === 200) {
    //       this.$store.commit('updateUserInfo', res.data.data)
    //     }
    //   })
    //   .catch(err => {
    //     console.log(err)
    //   })
    window.addEventListener('beforeunload', () => {
      sessionStorage.setItem('store', JSON.stringify(this.$store.state))
    })
  }
}
</script>

<style>
* {margin: 0; padding: 0; text-decoration: none; list-style: none;}
a {text-decoration: none;}
html {
  width: 100%;
  height: 100%;
  display: flex;
}
body {
  width: 100%;
  height: 100%;
  min-width: 1024px;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}
</style>
